#ifndef REMOTECONTROL_H
#define REMOTECONTROL_H

#include "Arduino.h"
#include "SwitchRail.h"
#include "SwitchRailData.h"
#include "SwitchRailListener.h"
#include "Train.h"
#include "TrainData.h"
#include "TrainListener.h"
#include "Configuration.h"
#include "Command.h"
#include "Communication.h"
#include "CommunicationListener.h"

class RemoteControl : public SwitchRailListener, TrainListener, CommunicationListener {  
  public:
    RemoteControl(RemoteControlData remoteControlData);  /* Constructor */
    /* Methodes */
    void switchRailHasChanged(byte switchRailId, byte value);
    void trainSpeedHasChanged(byte trainId, boolean moveForward, byte value);
    void trainSmokeHasChanged(byte trainId, byte value);
    
    void trainSpeedCommandAccepted(byte trainId);
    void trainSpeedCommandAdapted(byte trainId);
    
    void switchRailCommandAccepted(byte switchRailId);
    void switchRailCommandDelayed(byte switchRailId);
  
    virtual void commandReceived(Command* command);

  private:
    /* Methodes */
    int getSwitchRailIndexFromId(byte id);  
    /* Attributs */
    SwitchRail* m_switchRails[NB_OF_SWITCH_RAILS];
    Train* m_trains[NB_OF_TRAINS];
    Communication* m_communication;
};

#endif /* REMOTECONTROL_H */
